<template>
	<view class="content" style="background-color: #f9f3c1;min-height: 100vh;padding: 10px;">
		<view 
		v-for="(item,index) in reslist"
		:key="index"
		@click="gones(item)"
		style="width: 100%;height: 280rpx;
			margin-top: 10px;
			margin-bottom: 10px;
		    display: flex;
		    flex-direction: row;
		    flex-wrap: nowrap;
		    justify-content: flex-start;
		    align-items: center;
			border-radius: 10px;
			background-color: white;
		">
			<view style="width: 60%;height: 100%;">
				<p style="padding: 10px;">{{item.newsTitle}}</p>
				<p style="
					padding: 10px;
				    position: relative;
				    top: 25rpx;
				    font-size: 14px;
				    color: #909090;
				">{{item.newsReleaseTime}}</p>
			</view>
			<view  style="width: 40%;height: 100%;border-radius: 10px;">
				<image style="width:100%;height: 100%;border-radius: 10px;" mode="scaleToFill" src="https://mp-7c5f2fa7-1d2c-41f1-b3dd-1f45e490fd36.cdn.bspapp.com/2024/08/22/93979839-33449935-2.jpg"></image>
			</view>
		</view>

<!-- 		<image style="margin: 0 auto;" v-if="shownews" src="http://www.hngsxy.com/projectresources/wxapp/news/llll1.gif"></image>
		<view v-if="item.newsId" class="media-item view" :key="index" hover-class="media-item-hover" v-for="(item,index) in reslist">
			<navigator :url="'../details/details?newsId=' + item.newsId">
				<view class="view">
					<text v-text="item.newsTitle" class="media-title"></text>
				</view>
				<view class="media-foot flex-row" style="flex-direction: row;">
					<view class="media-info flex-row" style="flex-direction: row;">
						<text class="info-text">{{item.newsAuthor}}</text>
						<text class="info-text">点击数:{{item.newsVisitConut}}</text>
						<text class="info-text">{{item.newsReleaseTime}}</text>
					</view>
				</view>
				<view class="media-item-line"></view>
			</navigator>
		</view> -->
		<page-head :title="temp01"></page-head>
	</view>
</template>

<script>
	var _this;
	export default {
		data() {
			return {
				temp01: '刷新中...',
				shownews: true,
				reslist: [],
				title: '',
				newsType: '',
				contentText: {
					contentdown: '查看更多',
					contentrefresh: '加载中',
					contentnomore: '没有更多'
				}
			}
		},
		onLoad(options) {
			_this = this
			this.newsType = options.newsType
			this.title = options.name
			// uni.setNavigationBarTitle({
			// 	title: options.name
			// });
			
			_this.NewsList(this.newsType)
		},
		onPullDownRefresh() {//上啦加装
			this.reslist = []
			this.NewsList(this.newsType)
			this.shownews = true
			this.temp01 = '刷新中...'
		},
		methods: {
			gones(item){
				vk.navigateTo("../details/details?newsId="+ item.newsId);
			},
			NewsList(newsType) {
				uni.request({
					url:'https://www.hngsxy.com/mybatisplus/gsxyNews/gsxyNewsList2',
					data:{
						newType: newsType
					},
					success: (res) => {
						// console.log(res.data)
						setTimeout(function() {
							_this.reslist = res.data
							_this.shownews = false
							_this.temp01 = '到底了'
						},666)
						uni.stopPullDownRefresh()
						
					},
					fail: (res) => {
						console.log("未知错误");
					}
				})
				
			},

		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		background-color: white;
/* 		align-items: center;
		justify-content: center; */
	}
	.view {
		flex-direction: column;
	}

	.flex-row {
		flex-direction: row;
	}

	.flex-col {
		flex-direction: column;
	}

	.list-cell {
		width: 750upx;
		padding: 0 30upx;
	}

	.uni-list-cell-hover {
		background-color: #eeeeee;
	}

	.media-item {
		position: relative;
		flex: 1;
		flex-direction: column;
		/* border-bottom-width: 1upx;
		border-bottom-style: solid;
		border-bottom-color: #ebebeb; */
		padding: 20upx 30upx 21upx 30upx;
	}

    .media-item-hover{
        background-color: #eee;
    }

	.media-item-line {
		position: absolute;
		left: 30upx;
		right: 30upx;
		bottom: 0;
		height: 2.5upx;
		background-color: #888888;
	}

	.media-image-right {
		flex-direction: row;
	}

	.media-image-left {
		flex-direction: row-reverse;
	}

	.media-title {
		flex: 1;
	}

	.media-title {
		lines: 3;
		text-overflow: ellipsis;
		font-size: 30upx;
		color: #555555;
	}

	.media-title2 {
		flex: 1;
		margin-top: 6upx;
		line-height: 40upx;
	}

	.image-section {
		margin-top: 20upx;
		flex-direction: row;
		justify-content: space-between;
	}

	.image-section-right {
		margin-top: 0upx;
		margin-left: 10upx;
		width: 225upx;
		height: 146upx;
	}

	.image-section-left {
		margin-top: 0upx;
		margin-right: 10upx;
		width: 225upx;
		height: 146upx;
	}

	.image-list1 {
		width: 690upx;
		height: 481upx;
	}

	.image-list2 {
		width: 225upx;
		height: 146upx;
	}

	.image-list3 {
		width: 225upx;
		height: 146upx;
	}

	.media-info {
		flex-direction: row;
		align-items: center;
	}

	.info-text {
		margin-right: 20upx;
		color: #999999;
		font-size: 24upx;
	}

	.media-foot {
		margin-top: 25upx;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
	}

	.max-close-view {
		position: relative;
		align-items: center;
		flex-direction: row;
		width: 40upx;
		height: 30upx;
		line-height: 30upx;
		border-width: 1upx;
		border-style: solid;
		border-color: #aaaaaa;
		border-radius: 4px;
		justify-content: center;
		text-align: center;
	}

	.close-l {
		position: absolute;
		width: 18upx;
		height: 1upx;
		background-color: #aaaaaa;
	}

	.close-h {
		transform: rotate(45deg);
	}

	.close-v {
		transform: rotate(-45deg);
	}
	.example-body {
		padding: 30upx;
		background: #fff
	}
	.example-body {
		padding: 10upx 30upx;
	}
</style>